<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Leaflet TMS and OSM Example</title>
    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" />
</head>
<body>

<div id="map" style="width: 600px; height: 600px;"></div>

<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script>
    document.addEventListener('DOMContentLoaded', function() {
        var map = L.map('map').setView([31.562710059362658,120.29751401540051], 8); // 初始化地图并设置中心和缩放级别

        // 加载 OpenStreetMap 底图
        L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
            attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
        }).addTo(map);

        // 加载本地 TMS 切片。请根据你的文件路径进行修改
        L.tileLayer('./{z}/{x}/{y}.png', {
            tms: true,  // 表示这是一个 TMS 切片
            opacity: 0.7 // 切片的透明度，你可以根据需要进行调整
        }).addTo(map);
    });

</script>

</body>
</html>
